﻿using WebFoundation;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MHI.DeviceManager.Interfaces
{
    /// <summary>
    /// DevDevicemaintenanceT,table entity: dev_devicemaintenance_t
    /// </summary>
    public class DevDevicemaintenanceT : INotifyPropertyChanged
    {
        public static readonly string KeyId;
        public static readonly string KeyDeviceId;
        public static readonly string KeyMaintenanceType;
        public static readonly string KeyMaintenanceHour;
        public static readonly string KeyMaintenanceCost;
        public static readonly string KeyMaintenancePeriod;
        public static readonly string KeyMaintenancePeriodUnit;
        public static readonly string KeyMaintenanceContent;
        public static readonly string KeyGmtCreated;
        public static readonly string KeyPersonModified;
        public static readonly string KeyGmtModified;
        public static readonly string KeyStateInfo;
        public static readonly string KeyIsUse;
        public static readonly string KeyVersion;

        static DevDevicemaintenanceT()
        {
            KeyId = ExpressionHelper.GetPropertyName<DevDevicemaintenanceT>(r => r.Id);
            KeyDeviceId = ExpressionHelper.GetPropertyName<DevDevicemaintenanceT>(r => r.DeviceId);
            KeyMaintenanceType = ExpressionHelper.GetPropertyName<DevDevicemaintenanceT>(r => r.MaintenanceType);
            KeyMaintenanceHour = ExpressionHelper.GetPropertyName<DevDevicemaintenanceT>(r => r.MaintenanceHour);
            KeyMaintenanceCost = ExpressionHelper.GetPropertyName<DevDevicemaintenanceT>(r => r.MaintenanceCost);
            KeyMaintenancePeriod = ExpressionHelper.GetPropertyName<DevDevicemaintenanceT>(r => r.MaintenancePeriod);
            KeyMaintenancePeriodUnit = ExpressionHelper.GetPropertyName<DevDevicemaintenanceT>(r => r.MaintenancePeriodUnit);
            KeyMaintenanceContent = ExpressionHelper.GetPropertyName<DevDevicemaintenanceT>(r => r.MaintenanceContent);
            KeyGmtCreated = ExpressionHelper.GetPropertyName<DevDevicemaintenanceT>(r => r.GmtCreated);
            KeyPersonModified = ExpressionHelper.GetPropertyName<DevDevicemaintenanceT>(r => r.PersonModified);
            KeyGmtModified = ExpressionHelper.GetPropertyName<DevDevicemaintenanceT>(r => r.GmtModified);
            KeyStateInfo = ExpressionHelper.GetPropertyName<DevDevicemaintenanceT>(r => r.StateInfo);
            KeyIsUse = ExpressionHelper.GetPropertyName<DevDevicemaintenanceT>(r => r.IsUse);
            KeyVersion = ExpressionHelper.GetPropertyName<DevDevicemaintenanceT>(r => r.Version);
        }

        private int _id;
        private int _deviceId;
        private string _maintenanceType;
        private double _maintenanceHour;
        private double _maintenanceCost;
        private int _maintenancePeriod;
        private int _maintenancePeriodUnit;
        private string _maintenanceContent;
        private DateTime _gmtCreated;
        private string _personModified;
        private DateTime _gmtModified;
        private double _stateInfo;
        private int _isUse;
        private int _version;

        /// <summary>
        /// 编码 , column: id required
        /// </summary>
        [Required]
        public int Id
        {
            get { return _id; }
            set
            {
                if (_id != value)
                {
                    _id = value;
                    NotifyOfChange(KeyId);
                }
            }
        }

        /// <summary>
        /// 设备ID , column: device_id 
        /// </summary>
        public int DeviceId
        {
            get { return _deviceId; }
            set
            {
                if (_deviceId != value)
                {
                    _deviceId = value;
                    NotifyOfChange(KeyDeviceId);
                }
            }
        }

        /// <summary>
        /// 保养类型 , column: maintenance_type 
        /// </summary>
        [StringLength(10)]
        public string MaintenanceType
        {
            get { return _maintenanceType; }
            set
            {
                if (_maintenanceType != value)
                {
                    _maintenanceType = value;
                    NotifyOfChange(KeyMaintenanceType);
                }
            }
        }

        /// <summary>
        /// 保养工时 , column: maintenance_hour 
        /// </summary>
        public double MaintenanceHour
        {
            get { return _maintenanceHour; }
            set
            {
                if (_maintenanceHour != value)
                {
                    _maintenanceHour = value;
                    NotifyOfChange(KeyMaintenanceHour);
                }
            }
        }

        /// <summary>
        /// 保养费用 , column: maintenance_cost 
        /// </summary>
        public double MaintenanceCost
        {
            get { return _maintenanceCost; }
            set
            {
                if (_maintenanceCost != value)
                {
                    _maintenanceCost = value;
                    NotifyOfChange(KeyMaintenanceCost);
                }
            }
        }

        /// <summary>
        /// 保养周期 , column: maintenance_period 
        /// </summary>
        public int MaintenancePeriod
        {
            get { return _maintenancePeriod; }
            set
            {
                if (_maintenancePeriod != value)
                {
                    _maintenancePeriod = value;
                    NotifyOfChange(KeyMaintenancePeriod);
                }
            }
        }

        /// <summary>
        /// 保养周期单位 , column: maintenance_period_unit 
        /// </summary>
        public int MaintenancePeriodUnit
        {
            get { return _maintenancePeriodUnit; }
            set
            {
                if (_maintenancePeriodUnit != value)
                {
                    _maintenancePeriodUnit = value;
                    NotifyOfChange(KeyMaintenancePeriodUnit);
                }
            }
        }

        /// <summary>
        /// 保养内容 , column: maintenance_content 
        /// </summary>
        [StringLength(255)]
        public string MaintenanceContent
        {
            get { return _maintenanceContent; }
            set
            {
                if (_maintenanceContent != value)
                {
                    _maintenanceContent = value;
                    NotifyOfChange(KeyMaintenanceContent);
                }
            }
        }

        /// <summary>
        /// 创建时间 , column: gmt_created 
        /// </summary>
        public DateTime GmtCreated
        {
            get { return _gmtCreated; }
            set
            {
                if (_gmtCreated != value)
                {
                    _gmtCreated = value;
                    NotifyOfChange(KeyGmtCreated);
                }
            }
        }

        /// <summary>
        /// 更新人 , column: person_modified 
        /// </summary>
        [StringLength(10)]
        public string PersonModified
        {
            get { return _personModified; }
            set
            {
                if (_personModified != value)
                {
                    _personModified = value;
                    NotifyOfChange(KeyPersonModified);
                }
            }
        }

        /// <summary>
        /// 更新时间 , column: gmt_modified 
        /// </summary>
        public DateTime GmtModified
        {
            get { return _gmtModified; }
            set
            {
                if (_gmtModified != value)
                {
                    _gmtModified = value;
                    NotifyOfChange(KeyGmtModified);
                }
            }
        }

        /// <summary>
        /// 标识状态 , column: state_info 
        /// </summary>
        public double StateInfo
        {
            get { return _stateInfo; }
            set
            {
                if (_stateInfo != value)
                {
                    _stateInfo = value;
                    NotifyOfChange(KeyStateInfo);
                }
            }
        }

        /// <summary>
        /// 是否可用 , column: is_use 
        /// </summary>
        [Required]
        public int IsUse
        {
            get { return _isUse; }
            set
            {
                if (_isUse != value)
                {
                    _isUse = value;
                    NotifyOfChange(KeyIsUse);
                }
            }
        }

        /// <summary>
        /// 版本 , column: version 
        /// </summary>
        [Required]
        public int Version
        {
            get { return _version; }
            set
            {
                if (_version != value)
                {
                    _version = value;
                    NotifyOfChange(KeyVersion);
                }
            }
        }


        public event PropertyChangedEventHandler PropertyChanged;

        private void NotifyOfChange(string propertyName)
        {
            if (this.PropertyChanged != null)
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}